// KebabCaseToCamelCase

// prettier-ignore
type _KebabCaseToCamelCase<Str extends string> = 
  Str extends `${infer Item}-${infer Rest}`
    ? `${Item}${_KebabCaseToCamelCase<Capitalize<Lowercase<Rest>>>}`
    : Str;

{
  // 中划线转小驼峰
  type KebabCaseToLittleCamelCase<T extends string> = Uncapitalize<_KebabCaseToCamelCase<T>>;

  type res = KebabCaseToLittleCamelCase<'A-bb-cc-d'>; // type res = "aBbCcD"
  type res2 = KebabCaseToLittleCamelCase<'a-bb-cc-DDD'>; // type res2 = "aBbCcDdd"
}

{
  // 中划线转大驼峰
  type KebabCaseToBigCamelCase<T extends string> = Capitalize<_KebabCaseToCamelCase<T>>;

  type res = KebabCaseToBigCamelCase<'A-bb-cc-d'>; // type res = "ABbCcD"
  type res2 = KebabCaseToBigCamelCase<'a-bb-cc-DDD'>; // type res2 = "ABbCcDdd"
}

// 驼峰转中划线

// prettier-ignore
type CamelCaseToKebabCase<Str extends string> = 
  Str extends `${infer First}${infer Rest}`
    ? First extends Lowercase<First>
      ? `${First}${CamelCaseToKebabCase<Rest>}`
      : `-${Lowercase<First>}${CamelCaseToKebabCase<Rest>}`
    : Str;

{
  type res = CamelCaseToKebabCase<'aBbCcD'>;
}
